package gmed;
import java.sql.*;

public class DBConnection2 {

	
	private static Connection conn;
	private static String url = "jdbc:mysql://192.168.1.68:3306/";
	private static String dbName ="tp1sd";
	private static String driver = "com.mysql.jdbc.Driver";
	private static String userName = "luciana";
	private static String password = "123456";
	
	public DBConnection2 (){
		conn = null;
		try{
			Class.forName(driver).newInstance();
		} catch (Exception e){
			e.printStackTrace();
		}
	}
	
	private static Connection reconnect(){
		try{
			conn = DriverManager.getConnection(url+dbName,userName,password);
		} catch (Exception e){
			e.printStackTrace();
		}
		
		return conn;
	}

	public static Connection get_conn() {
		if (conn==null);
		reconnect();
		return conn;
	}

}
